import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/seniority',
    component: () => import(/* webpackChunkName: "layout" */ '../components/layout/index.vue'),
    children: [
      {
        path: '/seniority',
        name: 'seniority',
        component: () => import(/* webpackChunkName: "home" */ '../views/seniority/index.vue'),
        meta: {
          title: '计算年资',
          icon: 'icon-xingzhuang-wenzi',
          roles: ['root', 'admin'],
          breadcrumbName: ['计算年资']
        },
        title: '计算年资',
        hidden: false
      },
      {
        path: '/home',
        name: 'home',
        component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue'),
        meta: {
          title: 'Home页面',
          icon: 'icon-huiyuan',
          roles: ['root', 'admin'],
          breadcrumbName: ['home列表']
        },
        title: 'home列表',
        hidden: false
      },
      {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
        meta: {
          title: 'About页面',
          icon: 'icon-huiyuan',
          roles: ['root', 'admin'],
          breadcrumbName: ['about列表']
        },
        title: 'About页面',
        hidden: false
      }
    ]
  }
]

export {
  routes
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
